# -*- coding: utf-8 -*-
# @Time    : 2021/12/29 18:57
# @Author  : Claire
# @file : openJson.py
import json
#coding:utf-8
import json

class Json:

    def __init__(self,file_name=None):
        if file_name:
            self.file_name = file_name
        else:
            self.file_name = 'file_path/xxx.json'
        self.data = self.read_data()

    def read_data(self):
        with open(self.file_name,encoding='utf8') as fp:
            data = json.load(fp)
            return data

    #根据关键字获取数据
    def get_data(self,key):
        return self.data[key]
